home *** CD-ROM | disk | FTP | other *** search
/ AMIGA-CD 2 / Amiga-CD - Volume 2.iso / ungepackte_daten / 1993 / 8 / 02 / tips & tricks / overscan.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-01  |  1.3 KB  |  58 lines

  1. #include <intuition/intuition.h>
  2. #include <intuition/screens.h>
  3. #include <graphics/gfx.h>
  4. #include <graphics/gfxbase.h>
  5.  
  6. #ifdef LATTICE
  7. #include <clib/intuition_protos.h>
  8. #include <clib/graphics_protos.h>
  9. #endif
  10.  
  11. struct NewScreen myscreen = {
  12.   0,0, 640,512, 2, 0,1, HIRES|LACE, CUSTOMSCREEN,
  13.   NULL, NULL, NULL, NULL
  14. };
  15.  
  16. struct Library *IntuitionBase=NULL;
  17. struct GfxBase *GfxBase=NULL;
  18.  
  19. void SetOverscan(register struct Screen *screen )
  20. {
  21.  WORD anzzeilen = GfxBase->NormalDisplayRows;
  22.  WORD x=screen->Width,y=screen->Height;
  23.  struct ViewPort *vp=&(screen->ViewPort);
  24.  
  25.  if(anzzeilen>300) anzzeilen>>=1;
  26.  x -= 320;  if(vp->Modes & HIRES) x -= 320;
  27.  y -= anzzeilen;
  28.  if(vp->Modes & LACE)  y -= anzzeilen;
  29.  x >>=1; if(x<0) x=0; y >>=1; if(y<0) y=0;
  30.  
  31.  if(vp->Modes & HAM)
  32.  {
  33.   if(GfxBase->ActiView->DxOffset-x < 96)
  34.    x=GfxBase->ActiView->DxOffset-96;
  35.  }
  36.  vp->DxOffset = -x; vp->DyOffset = -y;
  37.  MakeScreen(screen);
  38.  RethinkDisplay();
  39. }
  40.  
  41. main()
  42. {
  43.   struct Screen *s;
  44.  
  45.   IntuitionBase=OpenLibrary("intuition.library",0);
  46.   GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",0);
  47.  
  48.   if( (s=OpenScreen(&myscreen)) ) {
  49.     Delay( 200 );
  50.     SetOverscan( s );
  51.     Delay( 200 );
  52.     CloseScreen( s );
  53.   }
  54.  
  55.   CloseLibrary( (struct Library *)GfxBase );
  56.   CloseLibrary( IntuitionBase );
  57. }
  58.